<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<script type="text/javascript" src="../js/jquery-1.10.2.js"></script>
<script type="text/javascript">


var arr = "";
$(document).ready(function() {
	
	function check() {
		arr = "";

		var my_form = document.myForm;
		var count = 0;

		for ( var i = 0; i < my_form.s_c_no.length; i++) {
			if (my_form.s_c_no[i].checked != '') {
				if(count == 1){
					arr += ",";	
				}
				arr += my_form.s_c_no[i].value;
				count = 1;
			}
		}
	}
	
	
 	$("#btnBuy").click(function(){
 		check();
	 	//alert(arr);
		$("#output").empty();
		var head = "<tr><td>번호</td><td>제품분류</td><td>제품이름</td><td>수량</td><td>금액</td></tr>";
		$("#output").append(head);  
		
		$('#listTable').html('');
	$.getJSON("cartItemBuy.do",{c_no : arr},
		function(data){
		var output = '';
		  		
		$(data).each(function(index,item){
			output += "<tr>";
				output += "<td><input type=checkbox id=c_no name=s_c_no value="+item.c_no+">"+ item.c_no + "</td>";
				output += "<td>" + item.i_category + "</td>";
				output += "<td>" + item.i_name + "</td>";
				output += "<td>" + item.c_ea + "</td>";
				output += "<td>" + item.i_price + "</td>";
				output += "</tr>";
				
				$("#output").append(output);  
				output = '';
			  	
			 })}
				 
	  );
	 
	 
	});
});

</script>

장바구니 목록

<form name="myForm" action="cartItemBuy.do" method="post" onsubmit="return check()">
<input type="hidden" name="c_no"/>

<table align="center" border="0" cellpadding="0" cellspacing="1" bgcolor="#a0a0a0" width="800">

<div id="listTable">

	<table id="output" align="center" width="720" border="1">
		<tr>
			<td>번호</td>
			<td>제품분류</td>
			<td>제품이름</td>
			<td>수량</td>
			<td>금액</td>
		</tr>
		<c:forEach var="list" items="${cartList }">
		<tr>
			<td>
				<input type="checkbox" id="c_no" name="s_c_no" value="${list.c_no }" />${list.c_no }
			</td>
			<td>
				${list.i_category }
			</td>
			<td>
				${list.i_name }
			</td>
			<td id="c_ea">
				${list.c_ea	 }
			</td>
			<td id="i_price">
				${list.i_price*list.c_ea }
			</td>
		</tr>
		</c:forEach>
	
	</table>
	</div>

<input type="button" id="aaabtn" value="aaa"/>
<input type="button" id="btnBuy" value="주문"/>
</table>
</form>